Skip to content

Conversation

fabienheureux
Copy link
Member

@fabienheureux fabienheureux commented Aug 28, 2025

Description succincte du problème résolu

Cf https://www.notion.so/accelerateur-transition-ecologique-ademe/SEO-Ajouter-un-backlink-au-niveau-des-iFrames-2326523d57d780d09411e91b9eb60c8f?source=copy_link

🗺️ contexte: SEO

💡 quoi: Ajout d'un backlink sur les iframes

🎯 pourquoi: Pour améliorer le SEO des intégrations par iframe

🤔 comment:

  • à la génération de l'iframe, on ajoute un backlink en dessous de l'iframe
  • le contenu doit etre contribuable de manière centralisée

Dans l'admin wagtail

  • ajout de champs permettant de contribuer les backlinks

En front

  • on fetch le contenu de chaque backlink à partir d'une clé unique
  • on l'ajoute dynamiquement au site qui nous embarque

Exemple résultats / UI / Data

image

Auto-review

Les trucs à faire avant de demander une review :

  • J'ai bien relu mon code
  • La CI passe bien
  • En cas d'ajout de variable d'environnement, j'ai bien mis à jour le .env.template
  • J'ai ajouté des tests qui couvrent le nouveau code

✅ Reste à faire (PR en cours)

📆 A faire (prochaine PR)

@fabienheureux fabienheureux force-pushed the add-backlink-on-iframes branch from 8149ae2 to ecff44a Compare September 1, 2025 08:31
@fabienheureux fabienheureux force-pushed the add-backlink-on-iframes branch from ecff44a to f6d983d Compare September 1, 2025 08:42
@fabienheureux fabienheureux marked this pull request as ready for review September 11, 2025 14:56
Copy link
Contributor

@kolok kolok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qu'il en soit ainsi :)

@fabienheureux fabienheureux assigned kolok and unassigned fabienheureux Sep 12, 2025
@fabienheureux fabienheureux enabled auto-merge (squash) September 15, 2025 09:23
Comment on lines +2 to +11
export async function generateBackLink(iframe: HTMLIFrameElement, key: BacklinkKey) {
const backlinkTag = document.createElement("div")
backlinkTag.setAttribute(
"style",
"font-size: 0.9rem; text-align: center; padding-top: 0.5rem;",
)
const backlinkContent = await fetch(`${origin}/embed/backlink?key=${key}`)
backlinkTag.innerHTML = await backlinkContent.text()
iframe.insertAdjacentElement("afterend", backlinkTag)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • mieux gérer les erreurs
  • ajouter test

@fabienheureux fabienheureux assigned fabienheureux and unassigned kolok Sep 15, 2025
) {
const iframe = document.createElement("iframe")
await generateBackLink(iframe, key)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await generateBackLink(iframe, key)
await generateBackLink(iframe, backlinkKey)

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants